package com.health.mapp.impl;

import org.apache.log4j.Logger;

import com.health.commons.MD5Password;
import com.health.db.model.UserLIST;
import com.health.db.service.user.IUserLISTService;
import com.health.mapp.bean.Header;
import com.health.mapp.bean.ModifyDocPasswordReq;
import com.health.mapp.bean.ModifyDocPasswordResp;
import com.health.mapp.utils.DateUtils;
import com.health.mapp.utils.Response;
import com.health.mapp.utils.ResultCode;

public class ModifyDocPasswordImpl implements ActionInterface{
	private static Logger logger = Logger.getLogger(ModifyDocPasswordImpl.class);
	
	
	IUserLISTService userLISTService  ;
	@Override
	public Response execute(Header header, Object reqBean) throws Exception {
		ModifyDocPasswordReq req = (ModifyDocPasswordReq) reqBean;
		ModifyDocPasswordResp _resp = new ModifyDocPasswordResp();
	
		
	    UserLIST userLIST = new UserLIST();
		
		userLIST.setRecid(Long.valueOf(req.getRecid()));
		
		userLIST.setPassword(MD5Password.getEncodedPassword_Hex(req.getPassword()));
		 
		userLIST.setPasswordCreateDate(DateUtils.now());
		userLIST.setUserNo(req.getMemberName());
		
		userLISTService.updatePassword(userLIST);
			
		_resp.setErrorCode(ResultCode.OPERATION_SUCCESS);
		_resp.setErrorMsg(ResultCode.OPERATION_SUCCESS_NOTE);
		return _resp;
	}
	public IUserLISTService getUserLISTService() {
		return userLISTService;
	}
	public void setUserLISTService(IUserLISTService userLISTService) {
		this.userLISTService = userLISTService;
	}
	
	

}
